"""
vision & mmWave data process pipelie
step 1: you should put raw vision data into PySlowFast, get the label for the initial detection.
        in our project it will be save as labels.npy, record the results of each test
"""

from utils.video_process_function import process_label
"""
alllabelfilepath='./VIDEO_TRANSFER_STATION/'
alllabelfilepathlist=os.listdir(alllabelfilepath)
alllabelfilepathlist = sorted(alllabelfilepathlist, key=lambda x: int(re.findall('\d+', x)[0]))

for i in tqdm(range(len(alllabelfilepathlist))):
    process_label(alllabelfilepath,alllabelfilepathlist[i])

after process_label function process 
you will save timestamp.npy for each action start and end timestamp
"""

"""
step 2: run "read_mmWave_data(6843).m" to read mmWave data, the raw data will save as bin file,
        this function will save it as "datetime".mat.
        then, read mat file
"""
from utils.mmWave_process_function import process_radardata

"""
    a='E:/HARDATASET/RADAR_TRANSFER_STATION/'
    b=os.listdir(a)
    b = sorted(b, key=lambda x: int(re.findall('\d+', x)[0]))
    # print(allradardatafilepathlist)
    for i in tqdm(range(len(b))):
        process_radardata(a,b[i],64)

after process_radardata function process 
you will save "datatime"_timestamp.npy for each chirp loops frame timestamp        
"""

"""
step 3: synchronization the vision data and mmWave data
"""

from utils.sensors_sync import synchronize_videoandradar_folders

allvideofolder='./VIDEO/', 
allradardatafolder='./RADAR/'

synchronize_videoandradar_folders(allvideofolder,
                                  allradardatafolder,
                                  videodt_format = "%Y%m%d%H%M",
                                  radardt_format = "%Y%m%d%H%M%S")

# this function will put same time capture data of vision and mmWave into one folder
# the folder name is follow as vision sensor capture time


"""
step 4: extract frames frome video to labeled the action
"""

from utils.video_process_function import extract_frames_from_video

extract_frames_from_video()